<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags"%>
<%@ taglib prefix="json4i18n" uri="http://www.baozun.cn/json4i18n"%>
<HTML>

<head>
<script type="text/javascript" src="${http_domain_static}/resources/scripts/jquery-1.9.0.min.js?${v}"></script>
<script type="text/javascript" src="${http_domain_static}/resources/scripts/jquery.loxia.js?${v}"></script>
<script type="text/javascript" src="${http_domain_static}/resources/scripts/jquery.loxia.locale-zh_CN.js?${v}"></script>
<script type="text/javascript" src="${http_domain_static}/resources/scripts/jquery.loxia.locale-en_US.js?${v}"></script>
<script type="text/javascript">
var locale = '${pageContext.response.locale}';
var j=jQuery.noConflict();
loxia.init({
	region : '${pageContext.response.locale}'
});





console.log(loxia.getLocaleMsg('SCONFIRM_YES'));

function go(value){
	window.location.href=setUrlParam(window.location.href,'locale',value);
}

function setUrlParam(url, name, value) {
	var r = url;
	if (r != null && r != 'undefined' && r != "") {
		value = encodeURIComponent(value);
		var reg = new RegExp("(^|)" + name + "=([^&#]*)(|$)");
		var tmp = name + "=" + value;
		if (url.match(reg) != null) {
			r = url.replace(eval(reg), tmp);
		} else {
			var sharpSparated = url.split('#');
			var questSparated = sharpSparated[0].split('?');

			r = questSparated[0] + "?" + tmp;

			if (questSparated.length > 1)
				r += "&" + questSparated[1];
			if (sharpSparated.length > 1)
				r += "#" + sharpSparated[1];
		}
	}
	return r;
}

</script>
</head>

<body>

<a href="javascript:go('zh_CN')">简体中文</a> <a href="javascript:go('en_US')">English</a>


<br>
目前语言环境${pageContext.response.locale}
<br>
读取配置文件-----------><spring:message code='test1' />
<br>
数据国际格式化-----------><json4i18n:read val='${GJH}' />
<br>
传值
<c:forEach items="${list}" var="t">
${t}<br>
</c:forEach>
<br>
静态资源访问
<img src="/resources/images/banner/Xbox_banner_EN.jpg">
<br>
AJAX调用 <input type="button" value="简单" onclick="ajaxTest()">
<input type="button" value="复杂" onclick="ajaxTestFZ()">
<script type="text/javascript">
function ajaxTest(){
	j.post(
			"/tAjax",
			{
				name:"adfafd"
			},
			function(result){
			}
	);
}

function ajaxTestFZ(){
	var cmd=new Object();
	cmd.id=998;
	var list=new Array();
	var keyValue=new Object();
	keyValue.key="key";
	keyValue.value="value";
	list.push(keyValue);
	list.push(keyValue);
	cmd.list=list;
	
    j.ajax({
	    url:'/tAjaxFZ.json',
	    type: "POST",
	    data: JSON.stringify(cmd),
	    success: function(data){
	    	alert(data.t1);
	
	    },
	    dataType: "json",
	    contentType: "application/json"
  	});
}

</script>



















</body>
</HTML>

